using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using EntLibEC.Info.Online;
using EntLibEC.Dac.Online;
using EntLibEC.Dac;

namespace EntLibEC.Biz.Online
{
    public class FriendLinkManager
    {
        private static FriendLinkManager _instance;

        public static FriendLinkManager GetInstance()
        {
            if (_instance == null)
            {
                _instance = new FriendLinkManager();
            }

            return _instance;
        }

        public void Add(FriendLinkInfo friendLinkInfo)
        {
            new FriendLinkDac().Add(friendLinkInfo);
        }

        public DataSet GetLink(int linkType, int status)
        {
            string strSelect = "Select * from Ent_FriendLink with (nolock) ";
            if (linkType == 1)
                strSelect += " Where (LinkType=1 or LinkType=3) and Status=" + status.ToString();
            else if (linkType == 2)
                strSelect += " Where (LinkType=2 or LinkType=3) and Status=" + status.ToString();
            else if (linkType == 3)
                strSelect += " Where LinkType=3 and Status=" + status.ToString();
            else
                strSelect += " Where Status=" + status.ToString();

            return SqlHelper.ExecuteDataSet(strSelect);
        }
    }
}
